<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../../../favicon.ico">

    <title>登陆界面</title>
    <link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">  
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="/javascripts/jquery-3.3.1.js" type="text/javascript" charset="utf-8"></script>
    <!-- Bootstrap core CSS -->

    <!-- Custom styles for this template -->
    <link href="/stylesheets/signin.css" rel="stylesheet">
    
  </head>

  <body class="text-center">
    <div class="form-signin">
      <img class="mb-4" src="/images/login1.jpg" alt="" width="72" height="72">
      <h1 class="h3 mb-3 font-weight-normal">登陆</h1>
      <input type="text" class="form-control" placeholder="账号" id="user" aria-describedby="basic-addon1">
      <input type="text" class="form-control" placeholder="密码" id="pass" aria-describedby="basic-addon1" style="margin-bottom:10px">
      <button class="btn btn-lg btn-primary btn-block" type="submit" id="bt">登陆</button>
    </div>
  </body>
  <script>
    $('#bt').click(function(){
      $.ajax({
        type:"post",
        url:"/users/login",
        data:{user:$('#user').val(),pass:$('#pass').val()},
        success:function(data){
           if(data==1){
             alert('登陆成功')
             location.href='/'
           }else{
             alert('注册成功')
           }
        }
      })
    })
  </script>
</html>